package pers.wq.model.bean;

import java.util.LinkedHashMap;
import java.util.Map;

import pers.wq.model.CollegeModel;
import pers.wq.model.LessonCatModel;
import pers.wq.model.LessonModel;
import pers.wq.model.MajorModel;
import pers.wq.model.ScoreCatModel;
import pers.wq.util.StringUtil;
import pers.wq.util.TagManager;

public class MajorRequest extends BaseBean{
	private int mrid;
	private Major major;
	private Lesson lesson;
	private ScoreCat scoreCat;
	private int weight;
	
	@Override
	public Map<String, String> tagMap() {
		Map<String,String> reMap = new LinkedHashMap<String,String>();
		System.out.println("MajorRequest tagMap 1");
		if(getId() != 0){
			reMap.put(TAG_HIDDEN,TagManager.inputHidden("majorRequest.id", getId()+""));
		}
		System.out.println("MajorRequest tagMap 2");
		MajorModel mm = new MajorModel();
		System.out.println("MajorRequest tagMap 3");
		if(null == major) {
			major = new Major();
		}
		System.out.println("MajorRequest tagMap 4");
		Map<String,String> map = mm.getAllCollegeMap("mid","mname","major.cid="+major.getCollege().getCid());
		System.out.println("MajorRequest tagMap 5");
		String defaultKey = null == major ? null : StringUtil.strIsNull(major.getMid()) ? null : major.getMid();
		System.out.println("MajorRequest tagMap 6");
		reMap.put("专业", TagManager.selectTag("majorRequest.major.mid", defaultKey, map));
		System.out.println("MajorRequest tagMap 7");
		LessonModel lm = new LessonModel();
		System.out.println("MajorRequest tagMap 8");
		Map<String,String> map2 = lm.getAllCollegeMap("lid", "lname");
		System.out.println("MajorRequest tagMap 9");
		defaultKey = null == lesson ? null : lesson.getId() == 0 ? null : String.valueOf(lesson.getId());
		System.out.println("MajorRequest tagMap 10");
		reMap.put("课程", TagManager.selectTag("majorRequest.lesson.lid", defaultKey, map2));
		System.out.println("MajorRequest tagMap 11");
		ScoreCatModel scm = new ScoreCatModel();
		System.out.println("MajorRequest tagMap 12");
		Map<String,String> map3 = scm.getAllCollegeMap("sccid", "sccname");
		System.out.println("MajorRequest tagMap 13");
		defaultKey = null == scoreCat ? null : scoreCat.getId() == 0 ? null : String.valueOf(scoreCat.getId());
		System.out.println("MajorRequest tagMap 14");
		reMap.put("分数分类", TagManager.selectTag("majorRequest.scoreCat.id", defaultKey, map3));
		System.out.println("MajorRequest tagMap 15");
		reMap.put("权重",TagManager.inputText("majorRequest.weight", getWeight()+""));
		System.out.println("MajorRequest tagMap 16");
		return reMap;
	}
	@Override
	public int getId() {
		// TODO Auto-generated method stub
		return this.mrid;
	}
	@Override
	public void setId(int id) {
		// TODO Auto-generated method stub
		this.mrid = id;
	}
	public int getMrid() {
		return mrid;
	}
	public void setMrid(int mrid) {
		this.mrid = mrid;
	}
	public int getWeight() {
		return weight;
	}
	public void setWeight(int weight) {
		this.weight = weight;
	}
	public Major getMajor() {
		return major;
	}
	public void setMajor(Major major) {
		this.major = major;
	}
	public Lesson getLesson() {
		return lesson;
	}
	public void setLesson(Lesson lesson) {
		this.lesson = lesson;
	}
	public ScoreCat getScoreCat() {
		return scoreCat;
	}
	public void setScoreCat(ScoreCat scoreCat) {
		this.scoreCat = scoreCat;
	}
}
